﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Caipu_Set.aspx.cs" Inherits="Catering.Catering_Page.Caipin.Caipu_Set" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../Scripts/zhezhao.js" type="text/javascript"></script>
    <script src="../../Style/xxk.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/center.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/zhezhao.css" />
    <script language="javascript" type="text/javascript"> 
       var i=0;
        function Add_Shipuku_click() {
       i++;
            $("#shipuku").append("<tr >" +
          
                            "<td id=\"Add_" + i + "\" class=\"xh_td\">"+i+"</td>"+
                            "<td><input type=\"textbox\" id=\"kuName\" style=\"\"></td>"+
                            "<td>"+
                            "<select id=\"renyuan\" style=\"width:100px\">"+
                            "<option value=\"0\">苯作业人员</option>"+
                            "<option value=\"1\">铅作业人员</option>"+
                            "<option value=\"2\">高温作业人员</option>"+
                            "<option value=\"3\">低温作业人员</option>"+
                            "<option value=\"4\">刺激性气体接触人员</option>"+
                            "<option value=\"5\">航海人员</option>"+
                            "<option value=\"6\">晕船人员</option>"+
                            "</select>"+
                            "</td>"+
                            "<td><input type=\"textbox\" id=\"kuBack\"></td>" +
                            "<td align=\"center\"><a href=\"#\"> <img src=\"../../Images/trash.gif\" onclick=\"del_row_click("+i+")\" /></a></td>"+
                        "</tr>");

        }
        function Save_Shipuku_click() {
            var str_AddPice = "";
            
            $("#shipuku tr").each(function () {

                if ($(this).html().toString().indexOf("Add") > 0) {

                    str_AddPice = str_AddPice + $(this).find("[id='kuName']").val() +
                        "," + $(this).find("[id='renyuan']").val() +
                        "," + $(this).find("[id='kuBack']").val() +"|";
                       
                }
            });
            alert(str_AddPice);
            $.ajax({
                type: "Post",
                url: "../../PostDate.aspx/shipulu_Add",
                data: "{'shipuku':'" + str_AddPice + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {

                   
                }
            });
        }
        function del_row_click(rowid) {
             if($(this).parent().parent().html().index("add")<0)
             {
                  $.ajax({
                        type: "Post",
                        url: "../../PostDate.aspx/shipulu_Add",
                        data: "{'shipuku':'" + rowid + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (data) {

                   
                        }
                    });
             }else{
             $(this).parent().parent().remove();
             }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
  
            <div class="Center_Content" id="div2_4" >
            <div class="div_0207 left_width400" style="height: 500px; width: 100%">
                <h1>
                    <img src="../../Images/cp_h1_03.gif" />菜谱库</h1>
                <a href="#" class="add_innsert" onclick="Save_Shipuku_click()">保存</a> <a href="#" class="add_new" onclick="Add_Shipuku_click()">新增</a>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                    <thead>
                        <tr>
                            <td style="width: 50px">
                                序号
                            </td>
                            <td style="width: 250px">
                                菜谱库名称
                            </td>
                            <td style="width: 100px">
                                适用人群
                            </td>
                            <td style="width: 550px">
                                描述
                            </td>
                            <td style="width: 30px">
                                删除
                            </td>
                        </tr>
                    </thead>
                    <tbody id="shipuku">
                       <%= ViewState["html"] %>
                    </tbody>
                </table>
            </div>
        </div>
    </form>
</body>
</html>
